import request from "@/utils/request";
import { QueryForm, repertoryFormType } from "./types";
import {AxiosPromise} from "axios/index";

/**
 * 获取分页列表
 * @param data
 */
export function QueryRepertoryList(data: QueryForm) {
  return request({
    url: "api/v1/cmsOrder/page",
    method: "get",
    params: data,
  });
}

/**
 * 添加
 *
 * @param data
 */
export function addRepertory(data: repertoryFormType) {
	return request({
		url: '/api/v1/cmsOrder/create',
		method: 'post',
		data: data
	});
}

/**
 * 修改
 *
 * @param id
 * @param data
 */
export function updateRepertory(id: number, data: repertoryFormType) {
	return request({
		url: '/api/v1/cmsOrder/' + id,
		method: 'put',
		data: data
	});
}

/**
 * 批量删除，多个以英文逗号(,)分割
 *
 * @param ids
 */
export function deleteRepertorys(ids: string) {
	return request({
		url: '/api/v1/cmsOrder/' + ids,
		method: 'delete'
	});
}

/**
 * 获取详情
 *
 * @param id
 */
export function getRepertoryForm(id: number): AxiosPromise<repertoryFormType> {
	return request({
		url: '/api/v1/cmsOrder/' + id + '',
		method: 'get'
	});
}
/**
 * 收货
 */
export function shouhuoApi(data: any): AxiosPromise<repertoryFormType> {
	return request({
		url: '/api/v1/cmsOrder/returnOrder',
		method: 'post',
		data: data,
	});
}

